﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.EntityModel;
using System.ComponentModel.DataAnnotations;
using YasharEl.Infrastructure.Core.Prototype;
using YasharEl.Infrastructure.TaskEngine.Assignments;
using YasharEl.Infrastructure.Core.Commenting;
using YasharEl.Infrastructure.ObjectFactory;

namespace YasharEl.Infrastructure.TaskEngine.EntityModel.Metadata
{
    public class TaskEntityMetadata : Entity, ITask
    {
        [Key]
        public long TaskId
        {
            get;
            set;
        }

        public ITaskDefinition TaskDefinition { get; set; }

        public IList<ITaskAction> TaskActions { get; private set; }

        [Required]
        [StringLength(50)]
        public string TaskName
        {
            get;
            set;
        }

        [StringLength(1000)]
        public string TaskDescription
        {
            get;
            set;
        }

        public Guid? InitiatorCorrelationId { get; set; }

        public TaskPriority TaskPriority { get; set; }
        public TaskStatus TaskStatus { get; set; }
        public TaskStatusReason TaskStatusReason { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime? ModifiedDate { get; set; }
        public ITaskParticipant CreatedBy { get; set; }
        public ITaskParticipant ModifiedBy { get; set; }
        public bool IsDataModified { get; set; }

        public ITaskParticipant ConsultWith { get; set; }
        public DateTime? ReminderDate { get; set; }


        public override long Id
        {
            get
            {
                return TaskId;
            }
            protected set
            {
                TaskId = value;
            }
        }

        public IList<IPropertyInstance> Properties
        {
            get;
            private set;
        }

        public IPropertyInstance StoreValue(string key, object value, IDependencyResolver resolver)
        {
            throw new NotImplementedException();
        }

        public IList<ITaskAssignment> CurrentAssignments
        {
            get;
            set;
        }

        public ParticipantType ParticipantType
        {
            get;
            set;
        }

        #region ICommentable Members

        public IComment AddComment(string comment)
        {
            throw new NotImplementedException();
        }

        public IList<IComment> Comments
        {
            get;
            set;
        }

        #endregion
    }
}
